package com.xunan.demo.controller;

import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.net.URL;
import java.util.HashMap;
import java.util.Map;

@RestController
public class ServerlessInfoController {

    @GetMapping("/")
    public Map<String, String> result() {
        Map<String, String> map = new HashMap<>();

        //获取Resource绝对路径
        URL resourceAbsoluteUrl = this.getClass().getClassLoader().getResource("");
        if (resourceAbsoluteUrl != null) {
            String resourceAbsolutePath = resourceAbsoluteUrl.getPath();
            map.put("获取Resource绝对路径", resourceAbsolutePath);
        }

        return map;
    }

}
